
$(function(){
		var fiag = false;
	$('#administrator').blur(function() {
			var administrator1 = $('#administrator').val();
			$.ajax({
				url : '/admin/nameAndpw',
				data : {
					adminname : administrator1
				},
				type : 'post',
				success : function(response) {
				if (response != "succ") {
					$('.administrator').removeClass('glyphicon-ok');
					$('.administrator').addClass('glyphicon');
					$('.administrator').addClass('glyphicon-remove');
					fiag = false
				}
				if (response == "succ") {
					$('.administrator').removeClass('glyphicon-remove');
					$('.administrator').addClass('glyphicon');
					$('.administrator').addClass('glyphicon-ok');
					fiag = true
				}
			}
		})

	})
	$('#password').blur(function() {
		var administrator2 = $('#administrator').val();
		var password = $('#password').val();
		$.ajax({
			url : '/admin/nameAndpw',
			data : {
				adminname : administrator2,
				password : password
			},
			type : 'post',
			success : function(response) {
			if (response != "succ") {
				$('.password').removeClass('glyphicon-ok');
				$('.password').addClass('glyphicon');
				$('.password').addClass('glyphicon-remove');
				fiag = false
			}
			if (response == "succ") {
				$('.password').removeClass('glyphicon-remove');
				$('.password').addClass('glyphicon');
				$('.password').addClass('glyphicon-ok');
				fiag = true
			}
		},
		error:function(){
			alert('系统繁忙，请稍后再试！')
		}
	})

})
	
$('#login').click(function(){
		var adminname = $('#administrator').val();
		var password = $('#password').val();						
		if (adminname == "" || password == "") {
			alert("请检查所填信息");
			fiag = false;
		}
		if (fiag) {
			$.ajax({
				url : '/administratorlogin',
				data : $('#login_form').serialize(),
				type : 'post',
				success : function(response) {
					if (response != "succ") {
						alert("您没有登录权限")
					}
					if (response == "succ") {
						location.href="/backindex"
					}
				}
			})
		}
	
})






})